package com.xhwl.centiotdata.pushtrigger.passengerflows;

import com.xhwl.centiotdata.service.IPassengerFlowsNotificationCallbackService;
import com.xhwl.centiotdata.service.cent.IBiPassengerFlowsCentService;
import com.xhwl.common.dto.cent.face.SearchFaceDTO;
import com.xhwl.common.enums.CodeEnum;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.vo.cent.face.FaceSearchVO;
import com.xhwl.common.vo.cent.passengerflow.PassengerFaceFlowCallbackVO;
import com.xhwl.common.vo.cent.passengerflow.PassengerFlowNotificationCallbackVO;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lusong
 * @description 客流回调接口
 * @date 2021/12/23
 */
@RestController
@Log4j2
public class PassengerFlowsNotificationCallbackContrroller {

    @Autowired
    IPassengerFlowsNotificationCallbackService passengerFlowsNotificationCallbackService;

    /**
     * 接收过线统计回调消息
     *
     * @param callbackVO
     * @return
     */
    @RequestMapping(value = "/passenger-flows/receive-notification", method = RequestMethod.POST)
    public ResultJson handleNotification(@RequestPart("callbackVO") PassengerFlowNotificationCallbackVO callbackVO) {

        return passengerFlowsNotificationCallbackService.handleNotification(callbackVO);
    }

    /**
     * 接收人消息
     *
     * @param callbackVO
     * @return
     */
    @PostMapping("/passenger-flows/face-flow")
    public ResultJson handleFlowFace(@RequestPart("callbackVO") PassengerFaceFlowCallbackVO callbackVO) {
        //todo 处理客流图片和数据
        log.info("收到数据了 {}", callbackVO.toString());
        return passengerFlowsNotificationCallbackService.handleFlowFace(callbackVO);
    }


}
